package com.xj.edu.hotel.controller;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class FileConfig extends WebMvcConfigurationSupport {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 指定到D盘下的myfile文件夹
        registry.addResourceHandler("/myfile/**").addResourceLocations("file:D:/myfile/").addResourceLocations("classpath:/resources/");
        registry.addResourceHandler("/myfile/room/**").addResourceLocations("file:D:/myfile/room/").addResourceLocations("classpath:/resources/");
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
        super.addResourceHandlers(registry);
    }
}
